package cn.iocoder.yudao.module.scrm.enums.common;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;

/**
 * @Author LiZhiMin
 * @Date 2024/11/7 16:58
 */
@RequiredArgsConstructor
@Getter
public enum ScrmStatisticsDataTypeEnum implements IntArrayValuable {
    SCRM_STATISTICS_COUNT_CLUE(1, "获取-线索数量"),
    SCRM_STATISTICS_COUNT_CUSTOMER(2, "获取-客户数量|已锁定客户数|剩余的锁定数"),
    ;

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ScrmStatisticsDataTypeEnum::getType).toArray();

    /**
     * 类型
     */
    private final Integer type;
    /**
     * 名称
     */
    private final String name;



    public static ScrmStatisticsDataTypeEnum getEnumByType(Integer type) {
        return CollUtil.findOne(CollUtil.newArrayList(ScrmStatisticsDataTypeEnum.values()),
                item -> ObjUtil.equal(item.type, type));
    }
    @Override
    public int[] array() {
        return ARRAYS;
    }
}
